﻿using System;

namespace homework2_2_
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("输入上限");
            int up = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("输入下限");
            int low = Convert.ToInt32(Console.ReadLine());
            if (up <= low || low == 1) { Console.WriteLine("数值非法"); }
            int[] array1 = new int[999];
            int b = 0;
            for (int i = low; i <= up; i++)
            {
                int k = 0;
                for (int j = 2; j * j <= i; j++)
                {
                    if (i % j == 0)
                    {
                        k = 1;
                        break;
                    }
                }
                if (k == 0)
                {
                    array1[b] = i;
                    b++;
                }
            }
            int[] array2 = new int[b];
            for (int i = 0; i < b; i++)
            {
                array2[i] = array1[i];
            }

            int n = 0;
            for(int i = 0; i < b; i++)
            {
                Console.Write(array2[i]+" ");
                n++;
                if (n % 10 == 0) { Console.WriteLine(); }
            }
        }
    }
}